//
//  YDWithdrawalSuccessViewController.m
//  PeiZiWangBei
//
//  Created by 巨彦新 on 2017/12/19.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDWithdrawalSuccessViewController.h"
#import "YDRechargeWithdrawalButtonView.h"

@interface YDWithdrawalSuccessViewController ()<SYRechargeWithdrawalButtonViewDelegate>
@property (nonatomic, strong)YDRechargeWithdrawalButtonView *buttonView;
@property (nonatomic, strong)UIView *successView;
@property (nonatomic, strong)UILabel *successLbl;

@end

@implementation YDWithdrawalSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"提现";
    self.view.backgroundColor = [UIColor whiteColor];
    [self successView];
    [self successLbl];
    [self buttonView];
    
}



-(void)rechargeWithdrawalButtonViewButtonClick
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (UIView *)successView
{
    if (!_successView) {
        _successView = [UIView new];
        [self.view addSubview:_successView];
        [_successView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(isPhoneX ? @(rateX812(40)) : @(rate750(40)));
            make.centerX.equalTo(self.view);
            make.height.equalTo(isPhoneX ? @(rateX812(25)) : @(rate750(25)));
            make.width.equalTo(@(rate375(130)));
        }];
        UIImageView *image = [UIImageView new];
        image.image = [UIImage imageNamed:@"tixianchenggong"];
        image.contentMode = UIViewContentModeScaleAspectFit;
        [_successView addSubview:image];
        [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_successView.mas_left);
            make.centerY.equalTo(_successView);
        }];
        
        UILabel *tips = [UILabel new];
        [_successView addSubview:tips];
        [tips mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.right.bottom.equalTo(_successView);
            make.left.equalTo(image.mas_right).offset(rate375(9));
        }];
        tips.text = @"提现成功！";
        tips.textColor = [UIColor colorWithHexString:@"1E242E"];
        tips.font = [UIFont systemFontOfSize:font18ScreenWRate *LKScreenW];
        
    }
    return _successView;
}


- (UILabel *)successLbl
{
    if (!_successLbl) {
        _successLbl = [UILabel new];
        [self.view addSubview:_successLbl];
        [_successLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_successView.mas_bottom).offset(isPhoneX ? rateX812(40) : rate750(40));
            make.left.equalTo(@(rate375(27)));
            make.right.equalTo(@(-rate375(27)));
        }];
        _successLbl.text = @"提现金额将在10分钟内到达您指定的银行卡内，请留意短信通知。";
        _successLbl.numberOfLines = 0;
        _successLbl.lineBreakMode = NSLineBreakByCharWrapping;
        _successLbl.textColor = [UIColor colorWithHexString:@"1E242E"];
        _successLbl.font = [UIFont systemFontOfSize:font14ScreenWRate *LKScreenW];
      
    
    }
    return _successLbl;
}
-(YDRechargeWithdrawalButtonView *)buttonView
{
    if (_buttonView == nil) {
        YDRechargeWithdrawalButtonView *buttonView = [YDRechargeWithdrawalButtonView rechargeWithdrawalButtonWithButtonTitle:@"完成"];
        [buttonView enableButton];
        buttonView.delegate = self;
        [self.view addSubview:buttonView];
        
        [buttonView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self.view);
            if (isPhoneX) {
                make.height.equalTo(@(rateX812(63)));
            }else{
                make.height.equalTo(@(rate750(50)));
            }
        }];
        _buttonView = buttonView;
    }
    return _buttonView;
}

@end
